export function getTimeYMDMS(val) {
  let date = new Date(val);
  let time = "";
  let year = date.getFullYear();
  let month = date.getMonth() + 1;
  month = month < 10 ? "0" + month : month;
  let day = date.getDate();
  day = day < 10 ? "0" + day : day;
  let hour = date.getHours();
  hour = hour < 10 ? "0" + hour : hour;
  let minute = date.getMinutes();
  minute = minute < 10 ? "0" + minute : minute;
  let second = date.getSeconds();
  second = second < 10 ? "0" + second : second;
  time = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
  return time;
}

/**
 * 获取rgb的三个值
 * */

export function extractRGBValues(rgbString) {
  let bgColor = "rgba(254, 2, 2, 1)";
  if (rgbString) {
    bgColor = rgbString;
  }
  const match = bgColor.match(/^rgba\((\d+), (\d+), (\d+),/);
  if (match) {
    // 将匹配到的值转换为整数并返回
    return [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])];
  }
  return null; // 如果没有匹配到，返回null
}
